package usw.webserver.entity;

/**
 *
 *
 */
public class Method {

	public static final int	GET = 0;
	public static final int HEAD = 1;
	public static final int POST = 2;
	public static final int PUT = 3;
	public static final int DELETE = 4;
	public static final int TRACE = 5;
	public static final int CONNECT = 6;
	public static final int UNRECOGNIZED = 7;
	
	private int		method;
	private String strMethod;
	
	public int getMethod() {
		return method;
	}

	public void setStrMethod(String strMethod) {
		
		this.strMethod = strMethod;
		
		switch(this.strMethod)
		{
			case	"GET":
				method = GET;
				break;
				
			case	"HEAD":
				method = HEAD;
				break;
				
			case	"POST":
				method = POST;
				break;
				
			case	"PUT":
				method = PUT;
				break;
				
			case	"DELETE":
				method = DELETE;
				break;
				
			case	"TRACE":
				method = TRACE;
				break;
				
			case	"CONNECT":
				method = CONNECT;
				break;
			
			default:
				method = UNRECOGNIZED;
				break;
			
		}
	}
}
